package NC;

public class NC26 {
    public int removeDuplicates(int[] A) {
        if (A == null || A.length <= 2) {
            return A == null ? 0 : A.length;
        }
        int count = 2;
        for (int i = 2; i < A.length; i++) {
            if ( A[i] != A[count - 2]) {
                A[count++] = A[i];//A[count]==A[i];count+1;
            }
        }
        return count;
    }
}